/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package wwcontrolserver.controls;

import java.util.ArrayList;
import wwcontrolserver.datarecorders.WWControlServerLogger;
import wwcontrolserver.ifk.DigitalOutputIFK;

/**
 *
 * @author Michael Ferry
 */
public class DigesterMotorControl extends AbstractDutyCycleControl {
    private final DigitalOutputIFK MotorOutputIFK;
    private final int MotorOutputNum;
    private final ArrayList<ControlKey> AttachedControls = new ArrayList<ControlKey>();
    
    public DigesterMotorControl(DutyCycleControlState InitialState, WWControlServerLogger WWCSLog,
            DigitalOutputIFK MotorOutputIFK, int MotorOutputNum){
        super(InitialState, WWCSLog);
        
        this.MotorOutputIFK = MotorOutputIFK;
        this.MotorOutputNum = MotorOutputNum;
        AttachedControls.add(new ControlKey(MotorOutputIFK.GetIfkSerial()));
        AttachedControls.add(new ControlKey(MotorOutputIFK.GetIfkSerial(),MotorOutputNum));
    }
    @Override
    public ArrayList<ControlKey> GetListOfControlKeys(){
        return AttachedControls;
    }
    @Override
    public boolean GetBinaryOutputState() throws Exception {
        return MotorOutputIFK.GetOutputState(MotorOutputNum);
    }
    @Override
    public void SetBinaryOutputState(boolean State) throws Exception {
        MotorOutputIFK.SetOutputState(MotorOutputNum, State);
    }   
}
